package com.ns.basic.dict.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ns.basic.dict.dto.DictItemPageDto;
import com.ns.basic.dict.entry.DictItemEntry;
import com.ns.basic.dict.mapper.DictItemEntryMapper;
import com.ns.basic.dict.vo.DictItemEntryVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 字典项业务实现层
 *
 * @author liaowei
 */
@Service
@RequiredArgsConstructor
@Slf4j
public class DictItemEntryServiceImpl extends ServiceImpl<DictItemEntryMapper, DictItemEntry> implements IDictItemEntryService {
    private final DictItemEntryMapper mapper;

    @Override
    public List<DictItemEntryVO> listByDictId(Long dictId) {
        return mapper.selectByDictId(dictId);
    }

    @Override
    public List<DictItemEntryVO> listByDictCode(String code) {
        return mapper.selectByDictCode(code);
    }

    @Override
    public Page<DictItemEntryVO> getList(DictItemPageDto dto) {
        return mapper.getList(dto, new Page<>(dto.getCurrent(), dto.getSize()));
    }
}
